package com.xgkj.diyiketang.activity;

import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.xgkj.diyiketang.R;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Tao on 2017/4/11.
 */

class SchoolReportDeailAdapter extends BaseAdapter{
    private Context mContext;
    private List<String> mList;
    public SchoolReportDeailAdapter(Context mContext) {
        this.mContext = mContext;
        mList= new ArrayList<>();
    }

    public void updata(List<String> list){
        mList.addAll(list);
        notifyDataSetChanged();
    }

    @Override
    public int getCount() {
        return mList.size();
    }

    @Override
    public Object getItem(int position) {
        return mList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder mViewHolder = null;
        if(convertView==null){
            mViewHolder = new ViewHolder();
            convertView= LayoutInflater.from(mContext).inflate(R.layout.adapter_schoolreportdeail,null);
            mViewHolder.view= (TextView) convertView.findViewById(R.id.textView);
            convertView.setTag(mViewHolder);
        } else {
            mViewHolder = (ViewHolder) convertView.getTag();
        }
        Log.e("3a",mList.get(position));
        mViewHolder.view.setText(mList.get(position));
        return convertView;
    }


    class ViewHolder{
        TextView view;
    }
}
